package com.jushu.storbox.database;

import java.util.List;

import com.jushu.storbox.entities.DownloadObject;

public interface IDownloadFileDao  extends IBaseDao {
	
	public static final String TABLE_NAME = "tb_download_file_list";
	public static final String current_user_id = "current_user_id";
	public static final String TABLE_COMMAND = "Create table " + TABLE_NAME+ "(" 
			+ FIELD_ID + " integer," 
			+ id  + " text," 
			+ owner_by + " text," 
			+ file_name + " text," 
			+ parent_folder_id + " text,"
			+ trans_status + " integer ," 
			+ current_progress + " integer,"
			+ current_size + " integer,"	
			+ file_size + " integer," 
			+ local_path + " text,"
			+ objectID +" text, "
			+ lastUpdateDate +" integer,"
			+ isSync +" integer,"
			+ current_user_id + " text,"
			+ "CONSTRAINT pk_tb_shard_inode PRIMARY KEY ("+id+","+owner_by +")"
			+")";
	
	public static final String UPDATE_COMMAND = "Create table " + TABLE_NAME + "(" 
			+ FIELD_ID + " integer," 
			+ id  + " text," 
			+ owner_by + " text," 
			+ file_name + " text," 
			+ parent_folder_id + " text,"
			+ trans_status + " integer ," 
			+ current_progress + " integer,"
			+ current_size + " integer,"	
			+ file_size + " integer," 
			+ local_path + " text,"
			+ objectID +" text, "
			+ lastUpdateDate +" integer,"
			+ isSync +" integer,"
			+ current_user_id + " text,"
			+ "CONSTRAINT pk_tb_shard_inode PRIMARY KEY ("+id+","+owner_by +")"
			+")";
	
	public static final int REQUEST_SYNC_FALSE = 0;
	public static final int REQUEST_SYNC_TRUE = 1;
	
	/**
	 * @param fileInfo
	 * @param context
	 */
	public long insertFile(DownloadObject fileInfo);
	

	/**
	 * @param fileInfo
	 * @return
	 */
	public int updateDownloadObject(DownloadObject fileInfo);
	
	/**
	 * @param id
	 */
	public void deleteFile(String id, String ownerId);
	/**
	 * 
	 * @param id
	 * @param transStatus 0 no download，1 wait download    2. downloading    3.download finished    4.pause   5.stop
	 */
	
	public void updateDownloadState(String id, String ownerId, int transStatus);
	
	public void updateProgress(String id, String ownerId, long currentSize, long currentProgress);
	
	public List<DownloadObject> getDownloadFileList();
	
	public List<DownloadObject> getComplateDownloadFileList();
	
	public List<DownloadObject> getNotComplateDownloadFileList();
	
	public DownloadObject getDownloadFileById(String id, String ownerId);
}
